﻿package rosa.services {
	import rosa.RosaSettings;			import flash.net.NetConnection;	/**	 * NetConnection subclass
	 * @author Joseba Alonso	 * @see http://rozengain.com/?postid=47
	 */
	internal class RosaConnection extends NetConnection 	{		private var originalUrl:String;		private var urlSuffix:String;   		public function RosaConnection(gatewayURI:String = null)		{			this.originalUrl = gatewayURI;			this.objectEncoding = RosaSettings.defaultEncoding;			if (gatewayURI)			{				super.connect(gatewayURI);			}		}	   		internal function setCredentials(userId:String, password:String):void		{				super.addHeader("Credentials",false,{userid:userId,password:password});		}			protected function AppendToGatewayUrl(urlSuffix:String):void		{			this.urlSuffix = urlSuffix;			if (this.originalUrl == null)			{					this.originalUrl = uri; //???			}			var u:String = this.originalUrl + this.urlSuffix;			super.connect(u);		}			protected function ReplaceGatewayUrl(newUrl:String):void		{			super.connect(newUrl);		}			public function RequestPersistentHeader(info:Object ):void		{			super.addHeader(info.name, info.mustUnderstand, info.data);		}	}
}